package com.tomato.spring.basic.web.logic.controller;


import com.tomato.spring.basic.web.logic.bean.CutePetInfo;
import com.tomato.spring.basic.web.logic.service.CutePetInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 萌宠信息表 前端控制器
 * </p>
 *
 * @author Surging
 * @since 2024-07-07
 */

@RestController
@RequestMapping("/cutePetInfo")
public class CutePetInfoController {

    @Autowired
    private CutePetInfoService cutePetInfoService;


    @RequestMapping("/save")
    public String save(@RequestBody CutePetInfo cutePetInfo){
        cutePetInfoService.save(cutePetInfo);
        return "success";
    }

    @RequestMapping("/delete")
    public String delete(String id) {
        cutePetInfoService.removeById(id);
        return "success";
    }



    @RequestMapping("/update")
    public String update(@RequestBody CutePetInfo cutePetInfo) {
        cutePetInfoService.updateById(cutePetInfo);
        return "success";
    }

    @RequestMapping("/get/{id}")
    public CutePetInfo get(@PathVariable("id")String id) {
        return cutePetInfoService.getById(id);
    }

    @GetMapping("/list")
    @ResponseBody
    public Object list() {
        return cutePetInfoService.list();
    }
}
